package com.example.mykotlinapp

import java.lang.IllegalStateException

/**
 *
 *
 * @author zhudeshuai
 * @since 2019/7/11
 */

//基本数据类型 kotlin不区分基本数据类型和包装类型

private fun showProgress(progress: Int) {
    val percent = progress.coerceIn(0, 100)
    println("We are $percent% done!")
}

private fun test110() {
    val x = 1
    val list = listOf(1L, 2L, 3L)
    println(x.toLong() in list)
}

//Any Any?   所有类型的父类
private fun test111() {
    val answer: Any = 42
    println(answer is Int)
}

//Unit类型 kotlin中的void
private fun test112(): Unit {
    println("no return value")
}

//Nothing 类型  这个函数永不返回

private fun test113(message: String): Nothing {
    throw IllegalStateException(message)
}

//集合与数组

private fun test114() {
    val result = ArrayList<Int?>()
    result.add(1)
    result.add(null)
    result.add(2)
    println(result.filterNotNull())
}


private fun main() {

}